
<div class="tabs"><a tab="#tab_general">Thêm tin mới</a></div>
<div id="tab_general" class='page'>
    <script type="text/javascript" src="<?=base_url();?>js/admin/jquery.ui.core.js"></script>
    <script type="text/javascript" src="<?=base_url();?>js/admin/jquery.ui.datepicker.js"></script>
    <script type="text/javascript">
	$(function() {
		$( "#datepicker" ).datepicker();
	});
	</script>
<?php  echo form_open_multipart(base_url() . 'admin/manageproduct/add', 'class="crud"') ?>
	<table class="form">
		<tr>
			<td class="label">Tiêu đề </td>
            <td><input type='text' id='title' name='title'/></td>
		</tr>   
                <tr>
                    <td class="label">Loại</td>
                    <td>
                    	<select name="type">
                    		<option value=1>Thực phẩm chức năng</option>
                    		<option value=2>Thuốc</option>
                    	</select>
                    </td>
                </tr>
                <tr>
			<td class="label">Giới thiệu</td>
		<td>
                <textarea name="intro" id="intro" cols="50" rows="5"></textarea></td>
                </tr>
		<tr>
			<td class="label">Nội dung </td>
		<td>
                <textarea name="contents" id="contents"></textarea>
                <script type="text/javascript">
            	//<![CDATA[

                var editor = CKEDITOR.replace( 'contents',{
                        skin : 'kama',
                        filebrowserBrowseUrl : '<?=base_url();?>js/ckeditor/ckfinder/ckfinder.html',
                        filebrowserImageBrowseUrl : '<?=base_url();?>js/ckeditor/ckfinder/ckfinder.html?type=Images',
                        filebrowserImageUploadUrl : '<?=base_url();?>js/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
                        filebrowserFlashUploadUrl : '<?=base_url();?>js/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
                    });
	            //]]>
	            </script>
                <?php
                   // echo $editor->replace('contents');
                ?>
		</td>
		</tr>
                <tr>
                    <td class="label">Ảnh đại diện</td>
                    <td>
                        <input type="file" name="product_thumb" id="product_thumb" size="20" /> 
                    </td>
                </tr>
		<tr>
		 <input type="hidden" value="Add" name="add"/>
			<td>
			  <button onclick="return saveInfo();" type="submit" class="button" style="border: none;background: none"/>
		  		<span class="button_left button_save"></span>
				<span class="button_middle">Thêm</span>
				<span class="button_right"></span>
			</button>
			<a onclick="history.go(-1);" class="button">
				<span class="button_left button_cancel"></span>
				<span class="button_middle">Bỏ qua</span>
				<span class="button_right"></span>
			</a>
                            
			</td>
		</tr>
	</table>
    <div id="button"><input type="button" onclick="addData();return true;" value="Xem trước" /></div>
</div>

<div id="popupContact">
		<a id="popupContactClose">x</a>
                <br>
		<div class="title-left">
           		  <img class="img-title" src="<?=base_url()?>images/title-head.png">
           		  <h2 style=" color: #C00;" class="title" id="t"></h2>
                  <div class="clear"></div>
            	</div>
                
                    <div class="clear"></div>
                </div>
                <div class="clear"></div>
                <div class="conten-conten">
                    <p id="c"></p>                    <br><br>
                    <p style="float:right;"><b id="a"></b></p><br>
                </div>
	</div>
	<div id="backgroundPopup"></div>

<script type='text/javascript'>
    
    function addData(){
        var title = $('#title').val();
        var author = $('#author').val();
        var contents = CKEDITOR.instances.contents.getData();
        $('#t').text("");
        $('#c').text("");
        $('#a').text("");
        $('#t').append(title);
        $('#c').append(contents);
        $('#a').append(author);
    }
    
    function saveInfo(){
        var title = $('#title').val();
        var alias = $('#slug').val();
        var contents = CKEDITOR.instances.contents.getData();
		if(title == '' || title.length < 1){
			alert('Nhập tiêu đề');
			$('#title').focus();
			return false;
		}else if(alias == ''){
			alert('Nhập đường dẫn');
			$('#slug').focus();
			return false;
		}else if(contents == ''){
			alert('Nhập nội dung');
			CKEDITOR.instances.contents.focus();
			return false;
		}
		
    }
</script>

<script type="text/javascript">
$.tabs('.tabs a');
</script>